CXX := g++
WINCXX := i486-mingw32-g++
PROJDIRS := src inc
SRCFILES := $(shell find $(PROJDIRS) -mindepth 1 -maxdepth 3 -name "*.cpp")
HDRFILES := $(shell find $(PROJDIRS) -mindepth 1 -maxdepth 3 -name "*.hpp")
HYBRIDDEBUG :=
HYBRIDOBJFILES := $(patsubst %.cpp,%.odj,$(HYBRIDDEBUG))
DEBUGOBJFILES := $(patsubst %.cpp,%.odj,$(SRCFILES))
RELEASEOBJFILES := $(patsubst %.cpp,%.o,$(SRCFILES))
WINDOWSOBJFILES := $(patsubst %.cpp,%.obj,$(SRCFILES))

.PHONY: all clean todo

WARNINGS := -Wall -Wextra -Werror
CFLAGS := -g -std=c++0x $(WARNINGS)
WINFLAGS := $(CFLAGS) -I /usr/i486-mingw32/include/
LRFLAGS := -lsfml-graphics -lsfml-window -lsfml-system
LDFLAGS := -lsfml-graphics-d -lsfml-window-d -lsfml-system-d
WLFLAGS := -L /usr/i486-mingw32/lib/ $(LRFLAGS) -fPIC

all: bluehollow-debug

bluehollow-debug: $(DEBUGOBJFILES)
	@$(CXX) $(LDFLAGS) $^ -o bin/$@

bluehollow-release: $(RELEASEOBJFILES) $(HYBRIDOBJFILES)
	@$(CXX) $(LRFLAGS) $^ -o bin/$@

bluehollow-win32: $(WINDOWSOBJFILES)
	@$(WINCXX) $(WLFLAGS) $^ -o bin/$@

clean:
	-@$(RM) $(wildcard $(DEBUGOBJFILES) $(HYBRIDOBJFILES) $(RELEASEOBJFILES) $(WINDOWSOBJFILES) bin/bluehollow*)

%.odj: %.cpp Makefile
	@$(CXX) -DDEBUG -I./inc $(CFLAGS) -c $< -o $@

%.o: %.cpp Makefile
	@$(CXX) -I./inc $(CFLAGS) -c $< -o $@

%.obj: %.cpp Makefile
	@$(WINCXX) -I./inc $(WINFLAGS) -c $< -o $@
